#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define OJ_TEST 0
#define LOCAL_TEST 0

#define M 1000001

static int max(int a, int b){ return a>b?a:b; }
static int min(int a, int b) { return a<b?a:b; }

static int f91[M];
int f91_gen(int x){
	if(x>=M){
		return x - 10;
	}else{
		if(f91[x]) return f91[x];
		if(x<=100){
			return f91[x] = f91_gen((f91_gen(x+11)));
		}else{
			return f91[x] = x - 10;
		}
	}
}
static void solve(void){
	int n;
	while(scanf("%d", &n), n){
		printf("f91(%d) = %d\n", n, f91_gen(n));
	}

}
#if OJ_TEST
	int main(int ac, char *av[]){
		solve();
		return 0;
	}
#elif  LOCAL_TEST
	void run(void){
		solve();
	}

#else

#endif
